package cn.cas.mango.config;

public class Mapping {

  public static String getMapping(String type) {
    if (type.equals("news")) {
      return mapping();
    } else {
      return getClusterMapping();
    }
  }
  private static String mapping() {
    return
        "{" +
            "    \"properties\": {" +
            "        \"clusterKeywords\": {" +
            "            \"type\": \"nested\"," +
            "            \"properties\": {" +
            "                \"name\": {" +
            "                    \"type\": \"keyword\"" +
            "                }," +
            "                \"score\": {" +
            "                    \"type\": \"double\"" +
            "                }" +
            "            }" +
            "        }," +
            "        \"cluster_id1\": {" +
            "            \"type\": \"keyword\"" +
            "        }," +
            "        \"cluster_id3\": {" +
            "            \"type\": \"keyword\"" +
            "        }," +
            "        \"cluster_id5\": {" +
            "            \"type\": \"keyword\"" +
            "        }," +
            "        \"countryOrArea\": {" +
            "            \"type\": \"text\"," +
            "            \"fields\": {" +
            "                \"keyword\": {" +
            "                    \"type\": \"keyword\"," +
            "                    \"ignore_above\": 256" +
            "                }" +
            "            }" +
            "        }," +
            "        \"fssj\": {" +
            "            \"type\": \"date\"," +
            "            \"format\": \"yyyy-MM-dd\"" +
            "        }," +
            "        \"keywords\": {" +
            "            \"type\": \"nested\"," +
            "            \"properties\": {" +
            "                \"name\": {" +
            "                    \"type\": \"keyword\"" +
            "                }," +
            "                \"score\": {" +
            "                    \"type\": \"double\"" +
            "                }" +
            "            }" +
            "        }," +
            "        \"entities\": {" +
            "            \"type\": \"keyword\"" +
            "        }," +
            "        \"entities_person\": {" +
            "            \"type\": \"keyword\"" +
            "        }," +
            "        \"entities_organization\": {" +
            "            \"type\": \"keyword\"" +
            "        }," +
            "        \"entities_place\": {" +
            "            \"type\": \"keyword\"" +
            "        }," +
            "        \"cluster_entities\": {" +
            "            \"type\": \"keyword\"" +
            "        }," +
            "        \"cluster_entities_person\": {" +
            "            \"type\": \"keyword\"" +
            "        }," +
            "        \"cluster_entities_organization\": {" +
            "            \"type\": \"keyword\"" +
            "        }," +
            "        \"cluster_entities_place\": {" +
            "            \"type\": \"keyword\"" +
            "        }," +
            "" +
            "        \"lyss\": {" +
            "            \"type\": \"keyword\"" +
            "        }," +
            "        \"nm\": {" +
            "            \"type\": \"keyword\"" +
            "        }," +
            "        \"region\": {" +
            "            \"type\": \"keyword\"" +
            "        }," +
            "        \"sjmc\": {" +
            "            \"type\": \"text\"," +
            "            \"analyzer\": \"ik_max_word\"" +
            "        }," +
            "        \"sjms\": {" +
            "            \"type\": \"text\"," +
            "            \"analyzer\": \"ik_max_word\"" +
            "        }," +
            "        \"ssly\": {" +
            "            \"type\": \"keyword\"" +
            "        }" +
            "    }" +
            "}"
        ;
  }


  public static String getClusterMapping() {
    return "{" +
        "    \"properties\": {" +
        "        \"child\": {" +
        "            \"type\": \"keyword\"" +
        "        }," +
        "        \"clusterId\": {" +
        "            \"type\": \"keyword\"" +
        "        }," +
        "        \"date\": {" +
        "            \"type\": \"date\"," +
        "            \"format\": \"yyyy-MM-dd\"" +
        "        }," +
        "        \"id\": {" +
        "            \"type\": \"keyword\"" +
        "        }," +
        "        \"keywords\": {" +
        "            \"type\": \"nested\"," +
        "            \"properties\": {" +
        "                \"name\": {" +
        "                    \"type\": \"keyword\"" +
        "                }," +
        "                \"score\": {" +
        "                    \"type\": \"double\"" +
        "                }" +
        "            }" +
        "        }," +
        "        \"entities\": {" +
        "            \"type\": \"keyword\"" +
        "        }," +
        "        \"entities_person\": {" +
        "            \"type\": \"keyword\"" +
        "        }," +
        "        \"entities_organization\": {" +
        "            \"type\": \"keyword\"" +
        "        }," +
        "        \"entities_place\": {" +
        "            \"type\": \"keyword\"" +
        "        }," +
        "        \"score\": {" +
        "            \"type\": \"double\"" +
        "        }," +
        "        \"title\": {" +
        "            \"type\": \"keyword\"" +
        "        }," +
        "        \"type\": {" +
        "            \"type\": \"keyword\"" +
        "        }" +
        "    }" +
        "}" +
        "}"
        ;
  }
  public static String setting() {
    return "{" +
        "\"number_of_shards\": 1," +
        "\"number_of_replicas\": 0," +
        "\"max_result_window\": 100000" +
        "}";
  }
}
